#include "listedatecontact.h"

ListeDateContact::ListeDateContact()
{
}
DateContact ListeDateContact::DernierContact()
{
    DateContact d;
    DateContact c;
    foreach(c , *this)
    {
        if(c.getDate() > d.getDate() && c.getDate() <= QDate::currentDate())
            d = c;
    }
    return d;
}
QDate ListeDateContact::ProchainContact()
{
    QDate d;
    DateContact c;
    foreach(c , *this)
    {
        if(c.getDate() >= QDate::currentDate() && !c.getSuccess())
            return c.getDate();
    }
    return d;
}
void ListeDateContact::setListeDateContact(QSqlQuery query)
{
    while(query.next())
    {

        DateContact dateContact(query);
        this->append(dateContact);
    }
}
